home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / sprites / untdemo1.pas < prev    next >
Pascal/Delphi Source File  |  1996-04-08  |  1KB  |  51 lines

  1. unit Untdemo1;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, ExtCtrls, MChSpBg, Mchsprt;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     MChSpriteBgr1: TMChSpriteBgr;
  12.     MChSprite1: TMChSprite;
  13.     MChSprite2: TMChSprite;
  14.     procedure FormCreate(Sender: TObject);
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. function Sprite2PosFunc(AtTime: TDateTime):TPoint;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. function Sprite2PosFunc(AtTime: TDateTime):TPoint;
  31.   var
  32.     x,y,alpha: double;
  33.   begin
  34.   alpha:=2*Pi*(AtTime-Form1.MChSprite2.SprTimeStarted)*24.0*60.0-100.0/180.0*Pi;
  35.   x := Form1.MChSpriteBgr1.ClientWidth /2.0 +
  36.       (Form1.MChSpriteBgr1.ClientWidth /3.0)*cos(alpha);
  37.   y := Form1.MChSpriteBgr1.ClientHeight /2.0 +
  38.       (Form1.MChSpriteBgr1.ClientWidth /3.0)*sin(alpha);
  39.   Sprite2PosFunc:=Point(round(x),round(y));
  40.   Form1.MChSprite2.SprSetScale(1+1.0*sin(alpha));
  41.   end;
  42.  
  43. procedure TForm1.FormCreate(Sender: TObject);
  44.   begin
  45.   MChSprite2.SprPosFunc:=Sprite2PosFunc;
  46.   MChSprite2.SprCruise(-1);
  47.   MChSprite1.SprShowOn;
  48.   end;
  49.  
  50. end.
  51.